<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('数据检验任务(新功能)列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
          <!--  <div class="col-sm-12 search-collapse">-->
              <!--  <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>任务编码：</label>
                                <input type="text" name="rwbm"/>
                            </li>
                           &lt;!&ndash; <li>
                                <label>预报元数据ID：</label>
                                <input type="text" name="fmId"/>
                            </li>&ndash;&gt;
                        &lt;!&ndash;    <li>
                                <label>创建时间：</label>
                                <input type="text" class="time-input" placeholder="请选择创建时间" name="cjsj"/>
                            </li>&ndash;&gt;
                            <li>
                                <label>任务状态：</label>
                                <input type="text" name="rwzt"/>
                            </li>
                           &lt;!&ndash; <li>
                                <label>状态更新时间：</label>
                                <input type="text" name="gxsj"/>
                            </li>&ndash;&gt;
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>-->
            <!--</div>-->
<!--
            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:rwpgrw:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:rwpgrw:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:rwpgrw:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:rwpgrw:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>-->
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:rwpgrw:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:rwpgrw:remove')}]];
        var prefix = ctx + "system/rwpgrw";

        var yid = [[${yid}]]

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                queryParams: queryParams,
                modalName: "数据检验任务(新功能)",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '${comment}',
                    visible: false
                },
                {
                    field: 'rwbm',
                    title: '任务编码'
                },
                    {
                        field: 'ys',
                        title: '元素'
                    },
            /*    {
                    field: 'fmId',
                    title: '预报元数据ID'
                },*/
                {
                    field: 'cjsj',
                    title: '创建时间'
                },
                {
                    field: 'rwzt',
                    title: '任务状态',
                    formatter: function(value, row, index) {
                        if (value == "0") {
                            return "<p style='color: #d0d002'>正在执行</p>";
                        } else if (value == "1") {
                            return "<p style='color: green'>完成解析</p>";
                        } else if (value == "2") {
                            return "<p style='color: red'>执行失败</p>";
                        } else {
                            return value;
                        }
                    }
                },
                {
                    field: 'gxsj',
                    title: '状态更新时间'
                },
                    {
                        title: '统计',
                        align: 'center',
                        formatter: function(value, row, index) {
                            var actions = [];
                            //actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>任务列表</a> ');
                            if(row.rwzt == 1){
                                actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="detail(\'' + row.id + '\')">统计</a> ');
                            }else{
                                actions.push('<a style="pointer-events: none; /* 阻止点击 */\n' +
                                    '    cursor: not-allowed; /* 鼠标变禁止图标 */\n' +
                                    '    opacity: 0.6; /* 透明度降低 */\n' +
                                    '    background-color: #ccc; /* 背景变灰色（如果是按钮样式） */\n' +
                                    '    text-decoration: none; /* 去除下划线（可选） */" class="btn btn-info btn-xs" href="javascript:void(0)" onclick="detail(\'' + row.id + '\')">统计</a> ');
                            }

                            return actions.join('');
                        }
                    }
                /*,
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }*/]
            };
            $.table.init(options);
        });
        function queryParams(params) {
            var search = $.table.queryParams(params);
            search.fmId = yid;
            return search;
        }
        function detail(yid) {
            var url = prefix + '/rwtj/';
            $.modal.open("预报统计", url,1300,800);
        }
    </script>
</body>
</html>